<?php
namespace app\gc\home;
use app\common\controller\Common;

use app\gc\model\Gc_txt as gtM;
use app\gc\model\Gc_img as giM;
use app\gc\model\Gc_case as m_case;

use app\gc\model\Gc_gs as m_gs;
use app\gc\model\Gc_cate as m_cate;
use app\gc\model\Gc_gszp as m_gszp;

class Index extends Common
{
    public function index()
    {
		$row = gtM::where('type', 'home')->find()->toArray();
        $this->assign('txt_info', $row);
		
		$rows = giM::where('type', 'home_lb')->select();
        $this->assign('lb_list', $rows);
		
		
		$cate_list = m_case::where([])->order('orderby desc')->paginate(16);
        $this->assign('cate_list', $cate_list);
		
		// $gs_list = m_case::where([])->order('orderby desc')->paginate(16);
        // $this->assign('cate_list', $cate_list);
		
		
		$gs_list = giM::where('type', 'home_gs')->order('orderby desc')->paginate(8);
        $this->assign('gs_list', $gs_list);
		
		
		$footer_gs_list = m_gs::where('isfooter', '1')->order('orderby desc')->select();
		$this->assign('footer_gs_list', $footer_gs_list);
		
		$footer_txt = gtM::where('type', 'footer')->find()->toArray();
		$this->assign('footer_txt', $footer_txt);
		
        return $this->fetch();
    }
	
	public function about()
    {
		$row = gtM::where('type', 'about')->find()->toArray();
        $this->assign('txt_info', $row);
		
		$rows = giM::where('type', 'about_lb')->select();
        $this->assign('lb_list', $rows);
		
		$about_team = giM::where('type', 'about_team')->select();
        $this->assign('about_team', $about_team);
		
		$page = input('get.page');
		if (isset($page) && null !== $page) {
			
		} else {
			$page = 1;
		}
		
		$options=[
			'page'=>$page
			//,'path'=>url('index')
		];
		$gs_list = giM::where('type', 'home_gs')->order('orderby desc')->paginate(9,false,$options);
        $this->assign('gs_list', $gs_list);
		
		
		$page2 = input('get.page2');
		if (isset($page2) && null !== $page2) {
			
		} else {
			$page2 = 1;
		}
		
		$options2=[
			'page'=>$page2,
			'var_page' => 'page2'
		];
		$about_hd = giM::where('type', 'about_hd')->order('orderby desc')->paginate(6,false,$options2);
        $this->assign('about_hd', $about_hd);
		
		
		
		
		$footer_gs_list = m_gs::where('isfooter', '1')->order('orderby desc')->select();
		$this->assign('footer_gs_list', $footer_gs_list);
		
		$footer_txt = gtM::where('type', 'footer')->find()->toArray();
		$this->assign('footer_txt', $footer_txt);
		
        return $this->fetch();
    }
	
	
	public function mycase()
    {
		$row = gtM::where('type', 'case')->find()->toArray();
        $this->assign('txt_info', $row);
		
		
		$about_team = giM::where('type', 'about_team')->select();
        $this->assign('about_team', $about_team);
		
		$type = input('get.type');
		$page = input('get.page');
		if (isset($page) && null !== $page) {
			
		} else {
			$page = 1;
		}
		
		
		$w=[];
		if (isset($type) && !empty($type)) {
			 $w['cateid'] = ['=', $type];
		}else{
			$type=0;
		}
		
		$this->assign('cateid', $type);
		
		$options=[
			'page'=>$page
			,'path'=>url('gc/index/mycase','type=thinkphp')
		];
	
	
	
	
		$case_list = m_case::where($w)->order('orderby desc')->paginate(28,false,$options);
        $this->assign('case_list', $case_list);
	
		
		$cate_list = m_cate::where([])->order('orderby desc, id desc')->select();
		$this->assign('cate_list', $cate_list);
		 
		$footer_gs_list = m_gs::where('isfooter', '1')->order('orderby desc')->select();
		$this->assign('footer_gs_list', $footer_gs_list);

		$footer_txt = gtM::where('type', 'footer')->find()->toArray();
		$this->assign('footer_txt', $footer_txt);
		
        return $this->fetch();
    }
	
	
	public function server()
    {
		$row = gtM::where('type', 'server')->find()->toArray();
        $this->assign('txt_info', $row);
		
		$rows = giM::where('type', 'server_lb')->select();
        $this->assign('lb_list', $rows);
		
		
		
		$footer_gs_list = m_gs::where('isfooter', '1')->order('orderby desc')->select();
		$this->assign('footer_gs_list', $footer_gs_list);
		
		$footer_txt = gtM::where('type', 'footer')->find()->toArray();
		$this->assign('footer_txt', $footer_txt);
		
        return $this->fetch();
    }
	
	public function recruit()
    {
		$row = gtM::where('type', 'recruit')->find()->toArray();
        $this->assign('txt_info', $row);
		
		$rows = giM::where('type', 'recruit_lb')->select();
        $this->assign('lb_list', $rows);
		
		
		
		$m_gs = m_gs::where([])->select();
        $this->assign('m_gs', $m_gs);
		
		$m_gszp = m_gszp::where([])->select();
        $this->assign('m_gszp', $m_gszp);
		
		
		$footer_gs_list = m_gs::where('isfooter', '1')->order('orderby desc')->select();
		$this->assign('footer_gs_list', $footer_gs_list);
		
		$footer_txt = gtM::where('type', 'footer')->find()->toArray();
		$this->assign('footer_txt', $footer_txt);
		
        return $this->fetch();
    }
	
	
}